/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.hk.shop.service.shop;

import java.util.List;

import com.thinkgem.jeesite.modules.hk.shop.entity.shop.HkShopCoupon;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.hk.shop.entity.shop.HkUserCoupon;
import com.thinkgem.jeesite.modules.hk.shop.dao.shop.HkUserCouponDao;

/**
 * 乐购用户优惠券Service
 *
 * @author 李欣荣
 * @version 2018-09-28
 */
@Service
@Transactional(readOnly = true)
public class HkUserCouponService extends CrudService<HkUserCouponDao, HkUserCoupon> {

    public HkUserCoupon get(String id) {
        return super.get(id);
    }

    public List<HkUserCoupon> findList(HkUserCoupon hkUserCoupon) {
        return super.findList(hkUserCoupon);
    }

    public Page<HkUserCoupon> findPage(Page<HkUserCoupon> page, HkUserCoupon hkUserCoupon) {
        return super.findPage(page, hkUserCoupon);
    }

    @Transactional(readOnly = false)
    public void save(HkUserCoupon hkUserCoupon) {
        super.save(hkUserCoupon);
    }

    @Transactional(readOnly = false)
    public void delete(HkUserCoupon hkUserCoupon) {
        super.delete(hkUserCoupon);
    }

    public Page<HkUserCoupon> findPageByCouponId(String couponId) {
        Page<HkUserCoupon> page = new Page<HkUserCoupon>();
        page.setList(dao.findPageByCouponId(couponId));
        return page;
    }

    @Transactional(readOnly = true)
    public Page<HkUserCoupon> findUserCoupon(Page<HkUserCoupon> page, HkUserCoupon hkUserCoupon) {
        // 生成数据权限过滤条件（dsf为dataScopeFilter的简写，在xml中使用 ${sqlMap.dsf}调用权限SQL）
        hkUserCoupon.getSqlMap().put("dsf", dataScopeFilter(hkUserCoupon.getCurrentUser(), "o", "a"));
        // 设置分页参数
        hkUserCoupon.setPage(page);
        // 执行分页查询
        page.setList(dao.findList(hkUserCoupon));
        return page;
    }


}